# coding=utf-8
import requests

LOC_API = ("http://api.cellocation.com/cell/?m"
           "cc=460&mnc=1&lac=%s&ci=%s&output=json")


def location_convert(lac, ci):
    lac, ci = int(lac, 16), int(ci, 16)
    try:
        url = LOC_API % (lac, ci)
        print url
        resp = requests.get(url)
    except Exception as e:
        return None
    else:
        data = resp.json()
        print 'data: %s' % data
        if data['errcode'] == 0:
            return data
